echo "git pull"
git pull

echo "docker build"
docker build -t easyapi:1.0 .;

# 停止并删除旧版 easyapi container
CID=$(docker ps | grep "easyapi" | awk '{print $1}')
echo $CID
if [ "$CID" != "" ];then
  docker stop $CID
  docker rm $CID
fi

# 把刚刚build出来的镜像跑起来
docker run -p 8082:8080 --name easyapi --restart always -d easyapi:1.0;
docker ps -a;
docker rmi $(docker images | grep "none" | awk '{print $3}');
docker images;
docker logs easyapi;